#
# 二分探索木のテスト
#
use Avltree;

package Number;

sub new {
  my ($type, $num) = @_;
  my $obj = { 'value' => $num };
  bless $obj, 'Number';
  $obj;
}

sub compare {
  my ($obj1, $obj2) = @_;
  $obj1->{'value'} <=> $obj2->{'value'};
}

sub print_object {
  my $obj = shift;
  print $obj->{'value'}, "\n";
}

package main;

$root = Bintree->make_tree();
for( $i = 1; $i <= 7; $i++ ){
  my $obj = Number->new( $i );
  $root = $root->insert_tree( $obj );
}
$root->print_tree_test( 0 );

$root = Avltree->make_tree();
for( $i = 1; $i <= 7; $i++ ){
  my $obj = Number->new( $i );
  $root = $root->insert_tree( $obj );
}
$root->print_tree_test( 0 );

# end of file
